package cn.aitrox.ry.service.anno.dao.impl;

import cn.aitrox.ry.common.bean.Order;
import cn.aitrox.ry.common.dao.MapperSqlCallback;
import cn.aitrox.ry.common.dao.impl.BaseDaoImpl;
import cn.aitrox.ry.service.anno.dao.AnnoFileHandlerInfoDao;
import cn.aitrox.ry.service.anno.entity.AnnoFileHandlerInfoEntity;
import cn.aitrox.ry.service.anno.mapper.AnnoFileHandlerInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class AnnoFileHandlerInfoDaoImpl extends BaseDaoImpl<AnnoFileHandlerInfoEntity> implements AnnoFileHandlerInfoDao {

    @Autowired
    private AnnoFileHandlerInfoMapper mapper;

    @Override
    public void batchSave(List<AnnoFileHandlerInfoEntity> list) {
        super.batchInsert(list, 1000, new MapperSqlCallback<AnnoFileHandlerInfoEntity>() {
            @Override
            public void batchInsert(List<AnnoFileHandlerInfoEntity> objList) {
                mapper.batchInsert(objList);
            }
        });
    }

    @Override
    public List<AnnoFileHandlerInfoEntity> findByTaskId(Integer taskId) {
        AnnoFileHandlerInfoEntity cond = new AnnoFileHandlerInfoEntity();
        cond.setTaskId(taskId);
        return super.findByCondition(cond, Order.asc("id"));
    }

    @Override
    public List<AnnoFileHandlerInfoEntity> findByTaskIdSeriesUidsBizType(Integer taskId, List<String> seriesUidList, Integer bizType) {
        return mapper.findByTaskIdSeriesUidsBizType(taskId, seriesUidList, bizType);
    }
}
